import request from '@/utils/request'

export function list(tenantId) {
  return request({
    url: '/ss/role/list',
    method: 'get',
    params: {tenantId}
  })
}

export function findRolePage(tenantId, page, pageSize) {
  return request({
    url: '/ss/role/findRolePage',
    method: 'get',
    params: {tenantId: tenantId, page: page, pageSize: pageSize}
  })
}

export function initRoleData(tenantId) {
  return request({
    url: '/ss/role/initRoleData',
    method: 'get',
    params: {tenantId}
  })
}

export function add(data) {
  return request({
    url: '/ss/role/add',
    method: 'post',
    data: data
  })
}

export function addMenuList(data) {
  return request({
    url: '/ss/role/menuList',
    method: 'post',
    data: data
  })
}

export function getRoutes(params) {
  return request({
    url: '/ss/role/routes',
    method: 'get',
    params
  })
}


export function updateRole(data) {
  return request({
    url: `/ss/role/update`,
    method: 'post',
    data: data
  })
}

export function deleteRole(id) {
  return request({
    url: `/ss/role/delete`,
    method: 'get',
    params: {id}
  })
}
